//登录
function formSubmit() {
	var labels = document.getElementById("lables");
	$.ajax({
		type : "POST",
		url : "/HFG/login/auth",
		data : {
			account : $("#account").val(),
			passwords : $("#passwords").val()
		},
		dataType : "json",
		success : function(data) {
			if (data.result == "error") {
				labels.innerHTML = "<font color='red'>"+data.message+"</font>";
				document.getElementById("account").style.border = "2px solid  red";
				document.getElementById("account").value="";
				return false;
			} else if (data.result == "counts") {
				labels.innerHTML = "<font color='red'>"+data.message+"</font>";
				document.getElementById("account").style.border = "2px solid  red";
				document.getElementById("passwords").style.border = "2px solid  red";
				document.getElementById("account").value="";
				document.getElementById("passwords").value="";
				return false;
			} else if (data.result == "errors") {
				labels.innerHTML = "<font color='red'>"+data.message+"</font>";
				document.getElementById("passwords").style.border = "2px solid  red";
				document.getElementById("passwords").value="";
				return false;
			} else {
				window.location.href = "index.jsp";// 跳转到主页
			}
		}
	});
}

function checkNickname() {

	var account = document.getElementById("account").value;
	if (account == "") {
		document.getElementById("account").style.border = "2px solid  red";
		return false;
	} else {
		document.getElementById("account").style.border = "2px solid  green";
		return true;
	}
}

function checkPassword() {
	var password = document.getElementById("passwords").value;
	if (password == "") {
		document.getElementById("passwords").style.border = "2px solid  red";
		return false;
	} else {
		document.getElementById("passwords").style.border = "2px solid  green";
		return true;
	}
}